/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 2013-2014 sagyf Yang. The Four Group.
 */

define([ 'adminapp'], function ($app) {
    $app.navactive('game_gift');

    $app.formvalidator({
        'gift.name'       : {
            required : true,
            maxlength: 30
        },
        'gift.description': {
            maxlength: 200
        },
        'gift.integral': {
            number:true
        },
        'gift.status': {
            required : true
        },
        'gift.sequence': {
            required : true,
            digits : true
        },
        'gift.style': {
            required : true
        },
        'gift.effive_start': {
            required : true
        },
        'gift.effive_end': {
            required : true
        }
    }, 'dataForm');


    $app.uploader({'buttonText': '点击上传礼品图片',width: 140}, 'giftAttachmentUpload');

    $("#giftStyle").change(function() {
        var val = $(this).val();
        if(val == 1) {
            $("#giftValue").hide();
        } else {
            $("#giftValue").show();
        }
    });
});